<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="com.jxLC.Action.*"%>
<%@ page language="java" import="com.jxLC.Model.*" %>
<%@ page language="java" import="com.jxLC.Service.*" %>
<%@ page import="com.jxLC.util.*"%>
<%@include file="/checkLoginSession.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
LinkService linkservice = new LinkService();
Object[] ob = linkservice.getLinksArr();
List<Links> list1 = (List)ob[0];
List<Links> list2 = (List)ob[1];
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>:::江西低碳-管理员后台:::</title>
	<link href="/mycss/my.css"  rel="stylesheet" type="text/css" />
	<link href="/mycss/details.css"  rel="stylesheet" type="text/css" />
	<link href="/mycss/cm.css"  rel="stylesheet" type="text/css" />
	<script type="text/javascript" charset="utf-8" src="kindeditor/kindeditor.js"></script>
	<script type="text/javascript" src="/myjs/my.js"></script>
	<style type="text/css">
	 
    </style>
    <script type="text/javascript">

       window.onload=function()
    { 
        var result1 ="<%=request.getAttribute("Dosuccess")%>";
        var result2 ="<%=request.getAttribute("dodelete")%>";
        var result3 ="<%=request.getAttribute("viewmsg")%>";
        
        if(result1!='null'  &&  result1!=undefined)
       {
           alert(result1);
       }  
        if(result2!='null'  &&  result2!=undefined)
       {
           alert(result2);
       }  
        if(result3!='null'  &&  result3!=undefined)
       {
           alert(result3);
       }
    }
	</script>
  </head>
  
 <body style="background-color:#EBFCF3">
    <s:include value="/admin/header.jsp"></s:include>
	<center><div id="m" >
       <s:include value="/admin/left.jsp"></s:include>
       <div id="mc">
          <div id="mc1"></div>
          <div id="mc2">
           <h4 align="left"><img  src="/my.photo/photo/to.gif"><font style="color:black;font-family: 仿宋 ;font-weight: bold;">当前用户：</font><font style="color:blue;font-family: 仿宋 ;font-weight: bold;">管理员</font></h4>
           <h4 align="left"><img  src="/my.photo/photo/to.gif"><font style="color:black;font-family: 仿宋 ;font-weight: bold;">当前位置：</font><font style="color:blue;font-family: 仿宋 ;font-weight: bold;">上传文件列表</font></h4>
           <h4 align="left"><img  src="/my.photo/photo/to.gif"><font style="color:black;font-family: 仿宋 ;font-weight: bold;">操作：</font><font style="color:blue;font-family: 仿宋 ;font-weight: bold;"><a href="/admin/link_list.jsp">增加</a></font></h4>
          </div>
          <div id="mc3">
          <form action="addlinks" method="post">
          <table width="700">
             <tr>
             	<td>类型：
             		<select name="link.type">
	             		<s:if test="link != null">
	             			<option value="1" <s:if test="link.type == 1">selected="selected"</s:if> >战略合作伙伴</option>
	             			<option value="2" <s:if test="link.type == 2">selected="selected"</s:if> >友情链接</option>
	             			
	             			<input type="hidden" name="link.id" value="${link.id }">
	             		</s:if>
	             		<s:else>
	             			<option value="1" selected="selected" >战略合作伙伴</option>
	             			<option value="2">友情链接</option>
	             		</s:else>
             		</select>
             	</td>
             	<td>名称：<input name="link.lname" type="text" value="${link.lname }"/> </td>
             	<td>链接：<input name="link.link" type="text" value="${link.link }"/> </td>
             </tr>
             <tr>
             	<td colspan="10" align="center">
             		<input type="submit" value="提交">
             	</td>
             </tr>
          </table>
          </form>
           <table width="700" >
             <caption><font style="font-size:15px;font-weight: bold">链接列表</font>	</caption>
             <tr height="30">
               <th width="120">类型</th> <th width="150">名称</th> <th width="300">链接</th><th width="">操作</th>
             </tr>
             <%
           	for(int i=0;i<list1.size();i++){
           		Links lk = list1.get(i);
           	
             %>
          <tr >
          <td width="120">战略合作伙伴</td>
          <td width="80" align="center"><font style="font-size: 13px;"><%=lk.getLname()  %></font></td>
          <td align="center"><font style="font-size: 13px;"><%=lk.getLink() %></font></td>
          <td>
           <a href="getLinkEdit.action?id=<%=lk.getId() %>" target="_self">修改</a> || 
           <a href="linkdel.action?id=<%=lk.getId() %>" onclick="return confirm('确定要删除吗？')">删除</a>
          </td>
          </tr>
             <%
           	}
             %>
            <tr>
            	<td colspan="10" height="20"></td>
            </tr>
             <%
           	for(int i=0;i<list2.size();i++){
           		Links lk = list2.get(i);
           	
             %>
          <tr >
          <td width="120">友情链接</td>
          <td width="80" align="center"><font style="font-size: 13px;"><%=lk.getLname()  %></font></td>
          <td align="center"><font style="font-size: 13px;"><%=lk.getLink() %></font></td>
          <td>
           <a href="getLinkEdit.action?id=<%=lk.getId() %>" target="_self">修改</a> || 
           <a href="linkdel.action?id=<%=lk.getId() %>" onclick="return confirm('确定要删除吗？')">删除</a>
          </td>
          </tr>
             <%
           	}
             %>
          
             </table>
          </div>
       </div>
	</div></center>
	<s:include value="/admin/tail.jsp"></s:include>
</body>
</html>
